/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package com.bap.ele.workbench.model.Course.impl;

import com.bap.ele.workbench.model.Course.COURSEobject;
import com.bap.ele.workbench.model.Course.CoursePackage;
import com.bap.ele.workbench.model.Course.LANGUAGE;
import com.bap.ele.workbench.model.Course.PREVIEW;
import com.bap.ele.workbench.model.Course.REQUIREMENT;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>LANGUAGE</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link com.bap.ele.workbench.model.Course.impl.LANGUAGEImpl#getCourseObjects <em>Course Objects</em>}</li>
 *   <li>{@link com.bap.ele.workbench.model.Course.impl.LANGUAGEImpl#getRequirement <em>Requirement</em>}</li>
 *   <li>{@link com.bap.ele.workbench.model.Course.impl.LANGUAGEImpl#getPreview <em>Preview</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LANGUAGEImpl extends COURSEelementImpl implements LANGUAGE {
	/**
	 * The cached value of the '{@link #getCourseObjects() <em>Course Objects</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCourseObjects()
	 * @generated
	 * @ordered
	 */
	protected EList<COURSEobject> courseObjects;

	/**
	 * The cached value of the '{@link #getRequirement() <em>Requirement</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRequirement()
	 * @generated
	 * @ordered
	 */
	protected REQUIREMENT requirement;

	/**
	 * The cached value of the '{@link #getPreview() <em>Preview</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPreview()
	 * @generated
	 * @ordered
	 */
	protected PREVIEW preview;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LANGUAGEImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return CoursePackage.Literals.LANGUAGE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<COURSEobject> getCourseObjects() {
		if (courseObjects == null) {
			courseObjects = new EObjectResolvingEList<COURSEobject>(COURSEobject.class, this, CoursePackage.LANGUAGE__COURSE_OBJECTS);
		}
		return courseObjects;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public REQUIREMENT getRequirement() {
		if (requirement != null && requirement.eIsProxy()) {
			InternalEObject oldRequirement = (InternalEObject)requirement;
			requirement = (REQUIREMENT)eResolveProxy(oldRequirement);
			if (requirement != oldRequirement) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CoursePackage.LANGUAGE__REQUIREMENT, oldRequirement, requirement));
			}
		}
		return requirement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public REQUIREMENT basicGetRequirement() {
		return requirement;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRequirement(REQUIREMENT newRequirement) {
		REQUIREMENT oldRequirement = requirement;
		requirement = newRequirement;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CoursePackage.LANGUAGE__REQUIREMENT, oldRequirement, requirement));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PREVIEW getPreview() {
		if (preview != null && preview.eIsProxy()) {
			InternalEObject oldPreview = (InternalEObject)preview;
			preview = (PREVIEW)eResolveProxy(oldPreview);
			if (preview != oldPreview) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, CoursePackage.LANGUAGE__PREVIEW, oldPreview, preview));
			}
		}
		return preview;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PREVIEW basicGetPreview() {
		return preview;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPreview(PREVIEW newPreview) {
		PREVIEW oldPreview = preview;
		preview = newPreview;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, CoursePackage.LANGUAGE__PREVIEW, oldPreview, preview));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case CoursePackage.LANGUAGE__COURSE_OBJECTS:
				return getCourseObjects();
			case CoursePackage.LANGUAGE__REQUIREMENT:
				if (resolve) return getRequirement();
				return basicGetRequirement();
			case CoursePackage.LANGUAGE__PREVIEW:
				if (resolve) return getPreview();
				return basicGetPreview();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case CoursePackage.LANGUAGE__COURSE_OBJECTS:
				getCourseObjects().clear();
				getCourseObjects().addAll((Collection<? extends COURSEobject>)newValue);
				return;
			case CoursePackage.LANGUAGE__REQUIREMENT:
				setRequirement((REQUIREMENT)newValue);
				return;
			case CoursePackage.LANGUAGE__PREVIEW:
				setPreview((PREVIEW)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case CoursePackage.LANGUAGE__COURSE_OBJECTS:
				getCourseObjects().clear();
				return;
			case CoursePackage.LANGUAGE__REQUIREMENT:
				setRequirement((REQUIREMENT)null);
				return;
			case CoursePackage.LANGUAGE__PREVIEW:
				setPreview((PREVIEW)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case CoursePackage.LANGUAGE__COURSE_OBJECTS:
				return courseObjects != null && !courseObjects.isEmpty();
			case CoursePackage.LANGUAGE__REQUIREMENT:
				return requirement != null;
			case CoursePackage.LANGUAGE__PREVIEW:
				return preview != null;
		}
		return super.eIsSet(featureID);
	}

} //LANGUAGEImpl
